package cn.service.impl;

import cn.dao.CartsDao;
import cn.entity.Carts;
import cn.service.CartsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class CartsServiceImpl implements CartsService{
	@Autowired
	CartsDao cartsDao;
	@Override
	public int deleteByPrimaryKey(Object id) {
		return cartsDao.deleteByPrimaryKey(id);
	}

	@Override
	public int insert(Carts record) {
		return cartsDao.insert(record);
	}

	@Override
	public Carts selectByPrimaryKey(Object id) {
		return cartsDao.selectByPrimaryKey(id);
	}

	@Override
	public int updateByPrimaryKey(Carts record) {
		return cartsDao.updateByPrimaryKey(record);
	}

	@Override
	public List<Carts> find(Integer uid) {
		List<Carts> list=new ArrayList<Carts>();
		try{
			Map<String, Object> params=new HashMap<String, Object>();
			params.put("uid", uid);
			list=cartsDao.find(params);
		}catch(Exception ex){
			ex.printStackTrace();
		}
		return list;
	}



	
	
}
